<template>
	<a-modal
		v-model:visible="visible"
		title="识别方式"
		:mask-closable="false"
		:width="600"
		:destroy-on-close="true"
		@ok="handleOk"
		@cancel="handleCancel"
		:footer="null"
	>
		<a-form :model="formData">
			<a-form-item label="RFID：" name="rfidNum" v-if="formData.rfidFlag===1">
				{{formData.rfidNum}}
			</a-form-item>
			<a-form-item label="二维码：" name="qrcode" v-if="formData.qrcodeFlag===1">
				<vue-qrcode :value="formData.qrCode+'_'+formData.goodsName" :options="{ width: 100 }"></vue-qrcode>
			</a-form-item>
			<a-form-item label="条形码：" name="barcode" v-if="formData.barcodeFlag===1">
				<vue3-barcode :value="formData.qrCode" :height="50" />
			</a-form-item>
		</a-form>
	</a-modal>
</template>
<script setup name="bizGoodsRecognizeMethod">
	import Vue3Barcode from 'vue3-barcode'

	const visible = ref(false)
	// 表单数据
	const formData = ref({})

	// 打开抽屉
	const onOpen = (record) => {
		visible.value = true
		if (record) {
			formData.value = Object.assign({}, record)
		}
	}

	// 确定
	const handleOk = () => {
		handleClose()
	}

	const handleClose = () => {
		visible.value = false
	}

	// 抛出函数
	defineExpose({
		onOpen
	})
</script>
